package com.iafme.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.systemframework.jackson.CustomDecimalSerialize;
import lombok.Data;

import java.io.Serializable;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author summer
 * @version 1.0
 * @date 2025/3/25 19:52
 */
@Data
@SearchBean(tables = " iafme_certificate_order o LEFT JOIN iafme_member m ON o.memberId=m.id",orderBy = "o.examTime DESC")
public class CertificateOrderResDTO implements Serializable {

    @DbField("o.id")
    private Integer id;

    @DbField("o.orderNo")
    private String orderNo;

    @DbField("o.examineText")
    private String examineText;

    /**
     * 支付时间
     */
    @DbField("o.payTime")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date payTime;

    /**
     * 申请时间
     */
    @DbField("o.examTime")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date examTime;

    @DbField("o.details")
    private String details;

    @DbField("o.amount")
    @JsonSerialize(using = CustomDecimalSerialize.class)
    private BigDecimal amount;

    @DbField(" CASE WHEN o.status=0 THEN '未支付' WHEN o.status=1 THEN '已支付' ELSE '已取消' END")
    private String statusName;

    @DbField("o.status")
    private Integer status;
    /**
     * 0 支付 取消 1审核中 2审核通过 3审核未通过
     */
    @DbField("o.authorization")
    private Integer authorization;

    @DbField("o.memberId")
    private Integer memberId;

    @DbField("CASE WHEN o.payType=1 THEN '微信' WHEN o.payType=2 THEN '支付宝' ELSE '兑换码' END ")
    private String payType;

    @DbField("m.name")
    private String name;

    @DbField("m.igAasId")
    private String igAasId;
}
